<template>
	<siginIn :sign_list="sign_list" :dateCount="dateCount" :dateFlag="dateFlag" @click="getsigin"></siginIn>
</template>

<script>
	import siginIn from '../../components/fanxiao-sign/sigin-in.vue';
	import {
		getSignDay,
		getSignList
	} from '@/module/index.js'
	export default {
		components: {
			siginIn
		},
		data() {
			return {
				sign_list: [{
						discount: '',
						day: '3'
					},
					{
						discount: '',
						day: '10'
					},
					{
						discount: '',
						day: '15'
					},
					{
						discount: '',
						day: '20'
					},
					{
						discount: '',
						day: '25'
					},
					{
						discount: '',
						day: '30'
					}
				],
				dateCount: 0,
				dateFlag: false
			}
		},
		onShow() {
			this.getSignList()
		},
		methods: {
			getsigin() {
				this.getSignDay()
			},
			// 点击签到
			getSignDay() {
				getSignDay().then((res) => {
					if (res.code === 200) {
						console.log(res)
						this.getSignList()
					} else {
						uni.showToast({
							title: res.message,
							icon: "none"
						})
					}
				}).catch(err => {
					console.log(err)
				})
			},
			// 获取签到数据
			getSignList() {
				getSignList().then((res) => {
					if (res.code === 200) {
						console.log(res)
						this.dateCount = res.data.data.sign_number
						this.dateFlag = res.data.data.sign
					} else {
						uni.showToast({
							title: res.message,
							icon: "none"
						})
					}
				}).catch(err => {
					console.log(err)
				})
			},
		}
	}
</script>

<style>
</style>
